package com.es.servlet; /**
 * 描述:
 * es-servlet-
 *
 * @author Derek
 * 创建时间：2022-04-22 10:46
 */

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "AServlet", value = "/AServlet")
public class AServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        //
        String currentUser = (String) session.getAttribute("currentUser");
       /* if(currentUser == null){
            response.sendRedirect("fail.html");
        }*/
        //响应部分
        response.setContentType("text/html;charset=utf-8");
        //
        PrintWriter out = response.getWriter();
        out.println("页面A");
        out.println("<h3>当前用户："+currentUser+"</h3>");
        out.println("<a href='logout'>注销</a>");
        out.flush();

    }


}
